<template>
	<view class="container">
		<view>
			<view class="cell flex-ac flex-b">
				<view class="hd">旧密码</view>
				<input type="password" v-model="old" class="bd" placeholder="请输入旧密码" placeholder-style="color: #ACAFBF">
			</view>
			<view class="cell flex-ac flex-b">
				<view class="hd">新密码</view>
				<input type="password" v-model="newPwd" class="bd" placeholder="请输入新密码" placeholder-style="color: #ACAFBF">
			</view>
			<view class="cell flex-ac flex-b">
				<view class="hd">重复新密码</view>
				<input type="password" v-model="newPwd1" class="bd" placeholder="请再次输入新密码" placeholder-style="color: #ACAFBF">
			</view>
		</view>
		<view class="btnBox">
			<view class="btn flexmid" @click="sureChange">确定</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				old:'',
				newPwd: '',
				newPwd1: ''
			}
		},
		onLoad(opt) {
			if(opt) console.log('opt:', opt)
		},
		methods: {
			sureChange(){
				if(this.old === '') return this.$Toast.message('请输入旧密码')
				if(this.newPwd === '') return this.$Toast.message('请输入新密码')
				if(this.newPwd1 === '') return this.$Toast.message('请再次输入新密码')
				if(this.newPwd != this.newPwd1) return this.$Toast.message('两次新密码密码不一致')
				this.$Net.post('/consignorApi/sysUser/updatePassword',{
					password: this.old,
					newPassword: this.newPwd
				}).then(res=>{
					uni.clearStorage()
					this.$Toast.messageIcon('操作成功')
					setTimeout(()=>{
						this.$Jump.reLaunch('/pages/login/login')
					},1500)
				})
			},
		}
	}
</script>

<style lang="scss">
	page{ background-color: #f9f9f9; }
</style>

<style lang="scss" scoped>
	// @import './style.scss';
	.btnBox{
		width: 100%;
		padding: 0 40rpx;
		padding-top: 100rpx;
		.btn{
			width: 100%;
			height: 100rpx;
			background-color: #3DB020;
			border-radius: 10rpx;
			color: #fff;
			font-size: 32rpx;
		}
	}
	.cell{
		width: 100%;
		height: 110rpx;
		background-color: #fff;
		padding: 0 30rpx;
		border-bottom: 1rpx solid #EEEEEE;
		.hd{
			font-size: 30rpx;
			color: #777C99;
		}
		.bd{
			width: 450rpx;
			height: 100%;
			font-size: 30rpx;
			color: #3F4151;
			text-align: right;
		}
	}
	.cell:last-child{
		border-bottom: 0;
	}
</style>
